<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
</head>
<body>
<div id="app">

</div>
<script>
    //发送get请求
    //调用then用来处理响应结果，then中传递一个匿名的回调函数，其中response是响应结果
    //catch用来处理错误，当发生错误时，会执行catch中的语句
    axios.get("http://localhost:8080/vue/findAll").then(function (response) {
        console.log(response.data);
    }).catch(function (error) {
        console.log(error)
    });

    //get方式带参数的请求，参数直接写在问号后面就可以了
    axios.get("http://localhost:8080/vue/findById?id=1003").then(function (response) {
        console.log(response.data);
    }).catch(function (error) {
        console.log(error)
    });
    var app = new Vue({
        el: '#app',
        data: {},
        methods: {}
    });
</script>
</body>
</html>